﻿// Copyright © Microsoft Corporation.  All Rights Reserved.
// This code released under the terms of the 
// Microsoft Public License (MS-PL, http://opensource.org/licenses/ms-pl.html.)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Media.Media3D;
using System.Windows.Media.Animation;
using _3DHouse.CustomControl;
using System.Windows.Markup;
using System.Xml;
using System.IO;
using System.Reflection;
namespace _3DHouse
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void mainWindow_MouseDown(object sender, MouseButtonEventArgs e)
        {
            
        }

        private void mainWindow_Loaded(object sender, RoutedEventArgs e)
        {
                     

        }



        private void ButtonClick(object sender, RoutedEventArgs e)
        {
            // Get the current button.
            Button cmd = (Button)e.OriginalSource;
            if (cmd.Content.Equals("绘图"))
            {
                Drawing hui = new Drawing();
                hui.Show();
            } else if (cmd.Content.Equals("查看"))
            {
               // Viewer cha = new Viewer("f:\\3-1.xml","sensor1",AlarmType.Voice,SensorState.Alarm);
               // cha.Show();
                List<Sensor> list = new List<Sensor>();
                Sensor s1 = new Sensor();
                s1.State = SensorState.Alarm;
                s1.AlarmType = AlarmType.Light;
                s1.Name = "sensor1";
                Sensor s2 = new Sensor();
                s2.State = SensorState.Alarm;
                s2.AlarmType = AlarmType.Voice;
                s2.Name = "sensor2";
                Sensor s3= new Sensor();
                s3.State = SensorState.Alarm;
                s3.AlarmType = AlarmType.Light;
                s3.Name = "sensor3";
                list.Add(s1);
                list.Add(s2);
                list.Add(s3);
                Viewer vi = new Viewer("3-1.xml",list);               
                vi.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
                vi.WindowState = System.Windows.WindowState.Maximized;
                vi.Show();
            }
            
           
        }
         
     
   } 
    }
